package com.xiuyou.tracksdk.tracksdk.module;


import java.io.Serializable;

/**
 * Created by lhy on 2016/6/13.
 */
public  class ILocation implements Serializable{
    /**
     * 本地标识Id
     */
    private String id;
    /**
     * 用户的ak，授权使用
     */
    private String ak;
    /**
     * servicede ID，作为其唯一标识
     */
    private String service_id;
    /**
     * 经度
     */
    private String longitude;
    /**
     * 纬度
     */
    private String latitude;
    /**
     * entity唯一标识
     */
    private String entity_name;

    private String coord_type;

    private String loc_time;

    //n米/s
    private String speed;
    //状态(行驶或者停留)
    private String status;
    //扩展字段
    private String extend1;
    //扩展字段
    private String extend2;

    public String getAk() {
        return ak;
    }

    public void setAk(String ak) {
        this.ak = ak;
    }

    public String getService_id() {
        return service_id;
    }

    public void setService_id(String service_id) {
        this.service_id = service_id;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public String getEntity_name() {
        return entity_name;
    }

    public void setEntity_name(String entity_name) {
        this.entity_name = entity_name;
    }

    public String getCoord_type() {
        return coord_type;
    }

    public void setCoord_type(String coord_type) {
        this.coord_type = coord_type;
    }

    public String getLoc_time() {
        return loc_time;
    }

    public void setLoc_time(String loc_time) {
        this.loc_time = loc_time;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getSpeed() {
        return speed;
    }

    public void setSpeed(String speed) {
        this.speed = speed;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getExtend1() {
        return extend1;
    }

    public void setExtend1(String extend1) {
        this.extend1 = extend1;
    }

    public String getExtend2() {
        return extend2;
    }

    public void setExtend2(String extend2) {
        this.extend2 = extend2;
    }

    @Override
    public String toString() {
        return "Track{" +
                "id='" + id + '\'' +
                ", ak='" + ak + '\'' +
                ", service_id='" + service_id + '\'' +
                ", longitude='" + longitude + '\'' +
                ", latitude='" + latitude + '\'' +
                ", entity_name='" + entity_name + '\'' +
                ", coord_type='" + coord_type + '\'' +
                ", loc_time='" + loc_time + '\'' +
                ", speed='" + speed + '\'' +
                ", status='" + status + '\'' +
                ", extend1='" + extend1 + '\'' +
                ", extend2='" + extend2 + '\'' +
                '}';
    }

    public static String toJson(ILocation track){
        long time = Long.valueOf(track.getLoc_time());
        String json = "{\"ak\":\""+track.getAk()+"\"," +
                "\"service_id\":\""+track.getService_id()+"\"," +
                "\"entity_name\":\""+track.getEntity_name()+"\"," +
                "\"latitude\":\""+track.getLatitude()+"\"," +
                "\"longitude\":\""+track.getLongitude()+"\"," +
                "\"coord_type\":\""+track.getCoord_type()+"\"," +
                "\"loc_time\":\""+String.valueOf(time)+"\"}";
        return json;
    }
}
